<?php
/**
 * Created by PhpStorm.
 * User: zhj
 * Date: 2019/1/22
 * Time: 11:20
 */
namespace app\common\validate;
class Address extends ValidateBase
{

    // 验证规则
    protected $rule =   [
        'userid'          => 'require',
        'take_user'    => 'require',
        'phone'    => 'require|length:11',
        'provence'    => 'require',
        'city'          => 'require',
        'country'    => 'require',
        'detail'    => 'require',
    ];

    // 验证提示
    protected $message  =   [
        'userid.require'         => '用户id不能为空',
        'take_user.require'          => '收货人不能为空',
        'phone.require'    => '电话号码不能为空',
        'provence.require'          => '省市不能为空',
        'city.require'          => '市不能为空',
        'country.require'          => '区县不能为空',
        'phone.length'    => '电话号码不正确',
        'detail.require'          => '街道地址不能为空',
    ];

    // 应用场景
    protected $scene = [
        'add'  =>  ['userid', 'take_user', 'phone' ,'provence','city', 'country','detail']
    ];
}